﻿@model SimpleForum.Data.Models.Forum

@{
    ViewBag.Title = Model.Name;
}

<div id="content-top">
    <h2>@ViewBag.Title</h2>
    <span class="align-right">
        @Html.ActionLink("create a thread", "create", "thread", new { id = Model.Id }, null)
    </span>
    <span class="clearfix">&nbsp;</span>
</div>

<div class="box">
    <div class="box-container">
        @if (Model.SubForums.Any()) {
            foreach (var SubForum in Model.SubForums)
            {
                <div class="forum bottom-10" id="@SubForum.Id">
                    <div class="title align-left">@Html.ActionLink(SubForum.Name, "View", "forum", new { id = SubForum.Id, name = SubForum.Name.Slugify() }, null)</div>
                    <div class="description align-left" style="margin:3px 0 0 25px;">@SubForum.Description</div>

                    <h3 class="align-right">@SubForum.Threads.Count threads, @SubForum.TotalPosts posts</h3>

                    <span class="clearfix">&nbsp;</span>
                </div>
            }
        }
            
        <div class="align-right" id="post-stats" style="width:200px;background-color:#FFFFC1;padding:5px;">
            <div class="post-info">small stats window for interesting stuff...</div>
        </div>

        <div class="bottom-20 align-left" style="width:725px;" id="category-@Model.Id">
            @if (Model.Threads.Count() > 0)
            {
                foreach (var Thread in Model.Threads.OrderByDescending(x => x.CreatedDate))
                {
                <div class="thread bottom-20" style="width:725px;" id="@Thread.Id">
                    <span class="by">@Html.DisplayFor(x => Thread.CreatedDate) by @Html.DisplayFor(x => x.Creator, "User.Slim")</span>

                    <div class="counts">
                        <div class="count"><span class="blue">@Thread.Posts.Count</span><br />posts</div>
                        <div class="count"><span>@Thread.Views</span><br />views</div>
                    </div>

                    <div class="title">@Html.ActionLink(Thread.Name, "View", "thread", new { id = Thread.Id, name = Thread.Name.Slugify() }, null)</div>
                    <div class="tags">@Html.DisplayFor(x => Thread.Tags)</div>

                    <span class="clearfix">&nbsp;</span>
                </div>
                }
            }
            else
            {
                @Html.Notification(NotificationHelper.NotificationTypes.Attention, "No threads exist.")
            }
        </div>

        <span class="clearfix">&nbsp;</span>
    </div>
</div>